<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateActivityTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activity', function (Blueprint $table) {
            $table->increments('id');
            $table ->string('name')->nullable()->comment('活动名称');
            $table ->integer('img_id')->default(0)->comment('答卷页背景图id');
            $table ->string('desc')->nullable()->comment('活动描述');
            $table->string('province')->nullable()->comment('省份');
            $table->string('city')->nullable()->comment('城市');
            $table->string('area')->nullable()->comment('地区');
            $table->string('address_detail')->nullable()->comment('详细地址');
            $table->timestamp('start_time')->nullable()->comment('活动开始时间');
            $table->timestamp('end_time')->nullable()->comment('活动结束时间');
            $table->string('re_person')->nullable()->comment('负责人');
            $table ->integer('classify_id')->default(0)->comment('活动分类标识');
            $table ->integer('join_num_cap')->default(0)->comment('参与活动的人数上限');
            $table->text('info')->nullable()->comment('活动详情');
            $table ->integer('sort')->default(0)->comment('排序');
            $table->integer('status')->default(0)->comment('状态');
            $table -> softDeletes();
            $table->timestamps();
        });

        Schema::create('activity_img', function (Blueprint $table) {
            $table->increments('id');
            $table ->integer('activity_id')->default(0)->comment('封面图id');
            $table ->integer('img_id')->default(0)->comment('图片id');
            $table -> softDeletes();
            $table->timestamps();
        });

        Schema::create('user_activity', function (Blueprint $table) {
            $table->increments('id');
            $table ->integer('user_id')->default(0)->comment('关联用户');
            $table ->integer('activity_id')->default(0)->comment('活动id');
            $table->integer('status')->default(0)->comment('状态');
            $table -> softDeletes();
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
